package com.hyphenate.easeui.widget.presenter;

import android.content.Context;
import android.content.Intent;
import android.widget.BaseAdapter;

import com.hyphenate.chat.EMClient;
import com.hyphenate.chat.EMMessage;
import com.hyphenate.easeui.model.EaseDingMessageHelper;
import com.hyphenate.easeui.ui.EaseDingAckUserListActivity;
import com.hyphenate.easeui.widget.chatrow.EaseChatRow;
import com.hyphenate.easeui.widget.chatrow.EaseChatRowText;
import com.hyphenate.easeui.widget.chatrow.EaseChatRowTip;
import com.hyphenate.exceptions.HyphenateException;

/**
 * Created by zhangsong on 17-10-12.
 */

public class EaseChatTipPresenter extends EaseChatRowPresenter {
    private static final String TAG = "EaseChatTextPresenter";

    @Override
    protected EaseChatRow onCreateChatRow(Context cxt, EMMessage message, int position, BaseAdapter adapter) {
        return new EaseChatRowTip(cxt, message, position, adapter);
    }

    @Override
    public void onBubbleClick(EMMessage message) {
        super.onBubbleClick(message);
//
//        if (!EaseDingMessageHelper.get().isDingMessage(message)) {
//            return;
//        }
//
//        // If this msg is a ding-type msg, click to show a list who has already read this message.
//        Intent i = new Intent(getContext(), EaseDingAckUserListActivity.class);
//        i.putExtra("msg", message);
//        getContext().startActivity(i);
    }

    @Override
    protected void handleReceiveMessage(EMMessage message) {
//        if (!message.isAcked() && message.getChatType() == EMMessage.ChatType.Chat) {
//            try {
//                EMClient.getInstance().chatManager().ackMessageRead(message.getFrom(), message.getMsgId());
//            } catch (HyphenateException e) {
//                e.printStackTrace();
//            }
//            return;
//        }
//
//        // Send the group-ack cmd type msg if this msg is a ding-type msg.
//        EaseDingMessageHelper.get().sendAckMessage(message);
    }
}
